package cn.cake.reptile.entity;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * @author mengll
 * @date 2019/1/4 14:37
 */
public class CrawlStructs implements Iterable<CrawlStruct> {
    private LinkedList<CrawlStruct> dataList = new LinkedList<>();

    public CrawlStructs add(String url) {
        CrawlStruct crawlStruct = new CrawlStruct(url);
        add(crawlStruct);
        return this;
    }

    public CrawlStructs add(CrawlStruct crawlStruct) {
        dataList.add(crawlStruct);
        return this;
    }

    public CrawlStructs add(CrawlStructs crawlStructs) {
        crawlStructs.forEach(crawlStruct -> add(crawlStruct));
        return this;
    }

    @Override
    public Iterator<CrawlStruct> iterator() {
        return dataList.iterator();
    }
}
